package com.flybear.aqi.client;

import org.elasticsearch.client.Client;



import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;


/**
* Created by Administrator on 2017/9/4.
*/
public class EsUtil {
    public static ElasticSearchClient client = null;
    private  static Properties properties= new Properties();
    static {
        String filePath =  "custom.properties";
        try {
            InputStream in = new BufferedInputStream(EsUtil.class.getClassLoader().getResourceAsStream(filePath));

            properties.load(in);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static void close(Client client) {
        if (client != null) {
            client.close();
        }
    }
    public static void close() {
        if (client != null) {
            client.close();
        }
    }
    public static Properties getproperties(){
        return properties;
    }
    public static String getkey(String index){



    	return properties.getProperty(index);
    	
    }

}
